FINERACT-2468: Fix datatable operations in PostgreSQL non-public schemas#5452
Open
AshharAhmadKhan wants to merge 1 commit intoapache:developfrom
Open
Conversation
Use current_schema instead of hardcoded 'public' in getTableIndexes() and isTablePresent() methods to support multi-tenant PostgreSQL deployments where datatables reside in tenant-specific schemas. This fixes: - GET /datatables returning 404 for new datatables - Datatable save operations failing with 'Datatable not found' Root cause: Index metadata queries were looking in 'public' schema while table columns query correctly used current_schema, causing inconsistent behavior in GenericDataServiceImpl. Changes: - PostgreSQLQueryService.getTableIndexes(): Use current_schema - PostgreSQLQueryService.isTablePresent(): Use current_schema Testing: - All unit tests pass (93/93 in fineract-core) - Manual PostgreSQL verification confirms fix works correctly
f37ed02 to
94ec550
Compare
Author
|
Updated to use Changes made:
Regarding the CI failure: Thank you for your patience and review! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes datatable operations in PostgreSQL deployments using non-public schemas by replacing hardcoded
'public'schema references withcurrent_schema.Related Issues
Description
When using PostgreSQL with tenant-specific schemas (non-public), creating a new datatable causes:
GET /datatablesto return 404 with "Datatable not found"Root Cause:
getTableIndexes()andisTablePresent()inPostgreSQLQueryService.javahardcoded'public'schema whilegetTableColumns()correctly usedcurrent_schema, causing inconsistent table discovery inGenericDataServiceImpl.Solution: Modified both methods to use
current_schemainstead of hardcoded'public', ensuring all table metadata queries use the connection's current schema.Changes Made
PostgreSQLQueryService.getTableIndexes(): Changedschemaname = 'public'toschemaname = current_schemaPostgreSQLQueryService.isTablePresent(): Changedtable_schema = 'public'totable_schema = current_schemaTesting Performed
current_schemaquery finds indexes while'public'query doesn't (reproduces original bug)Manual Verification:
Impact
Checklist
Notes